package springinpractice.ch3.web;

import org.apache.log4j.Logger;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import springinpractice.ch3.model.Member;

/*
 * Author	:	Willie Wheeler and John Wheeler
 * Book		:	'Spring In Practice' [Book written by Willie Wheeler and John Wheeler]
 */

@Controller
public final class NominateController {
	private static final Logger log = Logger.getLogger(NominateController.class);
	
	private String thanksViewName;
	
	public void setThanksViewName(String thanksViewName) {
		this.thanksViewName = thanksViewName;
	}
	
	@RequestMapping(method = RequestMethod.GET)
	public Member form() {
		return new Member();
	}
	
	@RequestMapping(method = RequestMethod.POST)
	public String processFormData(Member member, Model model) {
		log.info("Processing nominee: " + member);
		return thanksViewName;
	}
}
